<template>
	<van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad_()">
		
		<view v-for="(item, index) in list" :key="index" :title="index" class="item">
			<view class="lf">
				<view>{{item.name  }}</view>
				<view class="right-bottom">{{item.time}}</view>
			</view>
			<view class="ce">
				<view>
					<van-tag v-if="item.payState == 'SUCCESS'" type="primary" size="medium" @click="openReport(item)">查看报告</van-tag>
					<view v-else>未付费</view>
				</view>
				<view class="right-top">{{item.orderNo}}</view>
			</view>
			<view class="rf">
				<view>
					<span class="left-top">{{ subKey(item.keyword)}}</span>
					<view>{{item.pricing}}</view>

				</view>
			</view>
		</view>
	</van-list>
</template>
<script>
	import {
		record
	} from '@/api/jinjian'
	export default {
		data() {
			return {
				list: [],
				loading: false,
				finished: false,
				pageNum: 0
			}
		},
		methods: {
			onLoad_() {
				this.loading = true
				record(this.pageNum).then(res => {
					if (res.code == 200) {
						this.list.push(...res.data)
						if (res.data.length < 10) {
							this.finished = true
						} else {
							this.pageNum++
						}
					} else {
						this.finished = true
					}
					this.loading = false
				})
			},
			openReport(item) {
				this.go(item.code+'?orderNo=' + item.orderNo)
			},
			subKey(i_){
				if(!i_){
					return ''
				} else if(i_.length<6){
					return i_
				} else{
					return i_.substring(0,6)
				}
			}
		}
	}
</script>

<style>
	page {
		background: linear-gradient(180deg, #c4d6ff, #f7f8fa);
		min-height: 100%;
	}
	
	.item {
		margin: 4px 4px 0;
		border-radius: 8px;
		height: 60px;
		background: linear-gradient(to right, #F4F9F5, #FBF1E8);

		.lf {
			width: 150px;
		}

		.ce {
			width: 180px;
		}

		.rf {
			width: 90px;
		}

		display: flex;
		align-items: center;
		text-align: center;
	}

	.right-top {
		font-weight: 700;
		color: #333333;
		margin-top: 5px;
	}

	.left-top {
		color: #D9670F;
		font-size: 15px;
		font-weight: 600;
	}

	.right-bottom {
		color: #666666;
		margin-top: 10px;
	}
</style>